package buco.integrity.behaviour;

import java.util.regex.Pattern;

import org.json.simple.JSONObject;

import buco.core.api.SemanticConstraint;

public class DefineProtocol extends SemanticConstraint {
	
	private String className; 
	private String protocol;
	
	
	@Override
	protected void deserialize(JSONObject jsonObject) throws Exception {	
		className = jsonObject.get("class").toString();
		protocol = jsonObject.get("protocol").toString();	
	}

	public String getClassName() {
		return className;
	}

	public String getProtocol() {
		return protocol;
	}	
	
	public boolean matches(CheckProtocol check)  {		
		return Pattern.matches(protocol, check.getSequence()); 		
	}
}
